const Koa = require('koa')
const Router = require('koa-router')

const app = new Koa()


let router = new Router()

router.get('/', async (ctx) => {
  ctx.body = '首页'
}).get('/news', async (ctx) => {
  ctx.body = '这是一个新闻页面'
})

app.use(router.routes()) //启动路由
app.use(router.allowedMethods())


app.listen(3000, () => {
  console.log('服务启动成功')
})